<template>
  <div class="common-layout">
    <el-container style="width: 100%; height: 100%">
      <el-header>
        <el-switch
          v-model="environment"
          :active-action-icon="Moon"
          :inactive-action-icon="Sunny"
          @change="handleChange"
          style="margin-right:10px"
        />
        <el-dropdown placement="bottom">
          <el-avatar> 小白 </el-avatar>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>
                <el-icon><SwitchButton /></el-icon>
                <span>退 出</span>
              </el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-header>
      <el-main>
        <!-- <el-watermark style="width:100%;height:100%" content="不是小白" :font="{'color':waterColor}">  -->
          <Chat></Chat>
        <!-- </el-watermark> -->
      </el-main>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import Chat from '@/views/chat/index.vue'
import { Sunny, Moon } from '@element-plus/icons-vue'
const environment = ref(false)
const waterColor = ref('#f0f0f7')
interface HeadFace {
  icon:String,
  label:String
}
const handleChange = (e:Boolean)=>{
  if(!e){
    document.body.classList.add('light')
    document.body.classList.remove('dark')
    waterColor.value = '#f0f0f7'
  }else{
    document.body.classList.remove('light')
    document.body.classList.add('dark')
    waterColor.value = '#ffffff'
  }
  localStorage.setItem('environment',Number(e) + '')
}
</script>

<style lang="less" scoped>
.common-layout {
  width: 100%;
  height: 100%;
  background-color: var(--xb-bac-color);
  .el-header{
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }
}
.el-main{
  background-color: var(--xb-bac-color);
}
:deep(.el-header){
  border-bottom: 1px solid var(--xb-border-color);
  .el-dropdown{
    cursor: pointer;
    .el-avatar{
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 40px;
      display: inline-block;
    }
  }
  height: 50px;
  .el-page-header__header {
    height: 100%;
    justify-content: end;
  }
}
</style>
